package com.pen.interfece.mapper;

import com.github.pagehelper.Page;
import com.pen.interfece.pojo.dto.DormitoryPageQueryDTO;
import com.pen.interfece.pojo.entity.Dormitory;
import com.pen.interfece.pojo.vo.StudentVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper

public interface DormitoryMapper {

    @Insert("insert into dormitory(floor, dormitory_number) " +
            "values"+
            "(#{floor}, #{dormitoryNumber})")
    void save(Dormitory dormitory);

    @Delete("delete from dormitory where id = #{id}")
    void deleteById(Long id);


    void update(Dormitory dormitory);

    Page<Dormitory> pageQuery(DormitoryPageQueryDTO dormitoryPageQueryDTO);
    @Select("select * from student where dormitory_id=#{id}")
    List<StudentVO> selectByDormitoryId(int id);
    @Select("select * from dormitory where id=#{id}")
    Dormitory selectById(int id);
}
